<!--<?php 
if($groupid=='guest'){
$arr_logintypename = array('用户名','UID','电子邮箱');
print <<<EOT
-->
<form action="$db_bbsurl/login.php" name="login_FORM" method="post" onsubmit="return headerAjaxLogin.login(document.login_FORM);">
<input type="hidden" name="jumpurl" value="{$pwServer['HTTP_REFERER']}" />
<input type="hidden" name="step" value="2" />
<input type="hidden" name="cktime" value="31536000" />
<input type="hidden" name="ajax" value="1" />
<div class="header_login fr">
<table style="table-layout:fixed;">
	<tr>
		<td width="145">
<!--
EOT;
if (count($_LoginInfo['logintype']) >1) {print <<<EOT
-->
		<span class="fl"><a href="javascript:;" hidefocus="true" title="切换登录方式" class="select_arrow" onclick="showLoginType();">下拉</a></span>
		<div class="fl">
			<div class="pw_menu" id="login_type_list" style="position:absolute;display:none;margin:20px 0 0 0;">
				<ul class="menuList tal" style="width:134px;">
<!--
EOT;
foreach($_LoginInfo['logintype'] as $v){print <<<EOT
-->
					<li><a href="javascript:;" onclick="selectLoginType('$v','$arr_logintypename[$v]')" hidefocus="true">$arr_logintypename[$v]</a></li>
<!--
EOT;
}print <<<EOT
-->
				</ul>
			</div>
			</div>
<!--
EOT;
}print <<<EOT
-->
			<div class="login_row mb5"><label for="nav_pwuser" class="login_label">用户名</label><input type="text" class="input fl gray" onfocus="navCheckinput(this);" onblur="navCheckinput(this);" name="pwuser" id="nav_pwuser" value="输入用户名"></div>
			<div class="login_row"><label for="showpwd" class="login_label">密　码</label><input type="password" name="pwpwd" id="showpwd" class="input fl"></div>
		</td>
		<td width="75">
			<div class="login_checkbox" title="下次自动登录"><input type="checkbox" id="head_checkbox" name="cktime" value="31536000"><label for="head_checkbox">记住登录</label></div>
			<span class="bt2 fl"><span><button type="submit" name="head_login" style="width:70px;">登录</button></span></span>
		</td>
		<td width="70">
			<a href="sendpwd.php" class="login_forget" rel="nofollow">找回密码</a>
			<span class="btn2 fl"><span><button type="button" style="width:70px;" onClick="location.href='$db_bbsurl/$regurl#breadCrumb';">注册</button></span></span>
		</td>
	</tr>
</table>
</div>





<!--
EOT;
if (count($_LoginInfo['logintype'])>=1) {
$value = $_LoginInfo['logintype'][0];
empty($value) && $value = 0;
print <<<EOT
-->
<input type="hidden" name="lgt" id="nav_lgt" value="$value">
<!--
EOT;
} else {
print <<<EOT
-->
<input type="hidden" name="lgt" id="nav_lgt" value="0">
<!--
EOT;
}
print <<<EOT
-->
</form>
<!--
EOT;
/* platform weibo app --start */
L::loadClass('WeiboLoginViewHelper', 'sns/weibotoplatform/viewhelper', false);
$weiboLoginService = L::loadClass('WeiboLoginService', 'sns/weibotoplatform/service');
$loginWays = $weiboLoginService->getLoginWays();
if ($loginWays) {
	$firstWay = array_shift($loginWays);
	$windowOpenScript = WeiboLoginViewHelper_WindowOpenScript($firstWay['type']);
print <<<EOT
-->
<link rel="stylesheet" href="u/images/expand/weibologin.css" />
<div class="loginWays fr" style="position: relative;" onmouseover="showlogin(this)" onmouseout="hidelogin(this)">
	<span id="weibo_login" class="firstWay cp">
		<a href="javascript:;" onclick="$windowOpenScript"><img src="{$firstWay['loginLogo']}" alt="使用{$firstWay['accountTitle']}登录">{$firstWay['accountTitle']}登录</a>
		<span class="icon-down"></span>
	</span>
	<span class="text">内容互通，快速登录</span>

<!--
EOT;
	if ($loginWays) {
print <<<EOT
-->
<div id="menu_weibo_login" class="pw_menu" style="display: none;position: absolute; top:24px; left:0px;z-index:10;">
    <ul class="menuList" style="width:118px;">
<!--
EOT;
		foreach ($loginWays as $restWay) {
			$windowOpenScript = WeiboLoginViewHelper_WindowOpenScript($restWay['type']);
print <<<EOT
-->
        <li><a title="使用{$restWay['accountTitle']}登录" href="javascript:;" onclick="$windowOpenScript"><img src="{$restWay['loginLogo']}" />{$restWay['accountTitle']}登录</a></li>
<!--
EOT;
		}
print <<<EOT
-->
    </ul>
</div>
<!--
EOT;
	}
print <<<EOT
-->
</div>
<script type="text/javascript">

function showlogin(obj){
	if (getObj('menu_weibo_login')) getObj('menu_weibo_login').style.display=''
}
function hidelogin(obj){
	if (getObj('menu_weibo_login')) getObj('menu_weibo_login').style.display='none'
}
</script>
<!--
EOT;
}
/* platform weibo app --end */

print <<<EOT
-->

<script type="text/javascript">
var default_login_type = '$value';
var default_input_value = '输入' + '$arr_logintypename[$value]';

function check_user(obj){
	if(obj.value=="用户名"){
		obj.value='';
	}else if(obj.value==""){
		obj.value='用户名';
	}
}

function check_password(obj,type){
	if(type=='onfocus'){
		obj.style.display='none';
		getObj('relpwd').style.display='';
		getObj('relpwd').focus();
	}else{
		if(obj.value==''){
			obj.style.display='none';
			getObj('showpwd').style.display='';
		}
	}
}

function navCheckinput(obj){
	if (obj.className.indexOf('gray')!=-1) {
		obj.value = '';
		obj.className = obj.className.replace('gray', 'black');
	} else if (obj.value=='') {
		obj.value = obj.defaultValue = default_input_value;
		if (obj.className.indexOf('black') == -1) {
			obj.className += ' gray';
		} else {
			obj.className = obj.className.replace('black', 'gray');
		}
	}
}

function showLoginType(){
	if(getObj('login_type_list').style.display=='none'){
		getObj('login_type_list').style.display = '';
	} else {
		getObj('login_type_list').style.display = 'none';
	}
	if (IsElement('nav_logintab')){
		getObj('nav_logintab').style.display = 'none';
	}
}

function showcustomquest(qid){
	getObj('othercustomquest').style.display = qid==-1 ? '' : 'none';
}

function changeDefaultInputValue(text){
	getObj('nav_pwuser').value = text;
	getObj('nav_lgt').value = default_login_type;
}

function selectLoginType(type,text){
	var nav_pwuser = getObj('nav_pwuser');
	nav_pwuser.value = '输入'+text;
	if (nav_pwuser.className.indexOf('black') != -1) {
		nav_pwuser.className = nav_pwuser.className.replace('black', 'gray');
	}
	getObj('nav_lgt').value = type;
	getObj('login_type_list').style.display = 'none';
}

var headerAjaxLogin = {
	'username' : '',
	'pwd' : '',
	'login' : function(obj) {
		var _this = this;
		var username = obj.pwuser.value;
		if ((!username || username.indexOf('输入')===0) && !obj.pwpwd.value) {
			document.location.href="login.php";
			return false;
		}
		obj.head_login.disabled = true;
		_this.username = obj.pwuser.value;
		_this.pwd = obj.pwpwd.value;
		_this.submitBasicInfo(obj);
		return false;
	},
	
	'submitBasicInfo' : function(obj) {
		var url = 'login.php';
		if(getObj("headbase")){
			var baseUrl=getObj("headbase").href;
			var dm=document.domain;
			var old_dm=/^http:\/\/(([\w-]+\.)+[\w-]+)\//.exec(baseUrl)[1];
			if(old_dm!=dm){
				getObj("headbase").setAttribute("href",baseUrl.replace(old_dm,dm));
			}
		}
		ajax.send(url, obj, function() {
			var rText = ajax.request.responseText.split('\t');
			if (rText[0] == 'error') {
				showDlg('error', rText[1], 2);
				obj.head_login.disabled = false;
			} else if (rText[0] == 'success') {
				document.location.href = rText[1];
			} else {
				ajax.get('', '1','',1);
				var dd=document.documentElement;
				var cw=dd.clientWidth;
				var sh=dd.scrollHeight;
				var div=document.createElement("div");
				div.setAttribute("id","headerTmpMask");
				div.style.position="absolute";
				div.style.width=cw+"px";
				div.style.height=sh+"px";
				div.style.left=0;
				div.style.top=0;
				div.style.backgroundColor="#333";
				div.style.opacity="0.5";
				div.style.filter="alpha(opacity=50)";
				div.style.zIndex=1000;
				document.body.appendChild(div);
			}
		});
		return false;
	},
	
	'submitCheckInfo' : function(obj) {
		var _this = this;
		var url = 'login.php';
		var ifChangeGdcode = true;
		obj.pwuser.value = _this.username;
		obj.pwpwd.value = _this.pwd;
		ajax.send(url, obj, function() {
			var rText = ajax.request.responseText.split('\t');
			if (rText[0] == 'error') {
				if (rText[1] == 'gdcodeerror') {
					getObj('headrajaxlogintip').innerHTML = '验证码不正确或已过期';
				} else if (rText[1] == 'ckquestionerror') {
					getObj('headrajaxlogintip').innerHTML = '请输入正确的验证问题答案';
				} else if (rText[1] == 'safequestionerror') {
					getObj('headrajaxlogintip').innerHTML = '安全问题错误,您还可以尝试 ' + rText[2] + ' 次';
				}
				getObj('headrajaxlogintip').style.display = '';
			} else if (rText[0] == 'success') {
				location.href = rText[1];
				ifChangeGdcode = false;
			} else {
				getObj('headrajaxlogintip').innerHTML = rText[0];
				getObj('headrajaxlogintip').style.display = '';
			}
			if (ifChangeGdcode && getObj('changeGdCode')) getObj('changeGdCode').onclick();
		});
		return false;
	},
	
	'close' : function(obj) {
		document.login_FORM.head_login.disabled = false;
		closep();
		if(getObj("headerTmpMask")){
			var mask=getObj("headerTmpMask");
			mask.parentNode.removeChild(mask);
		}
	}
};
</script>
<!--
EOT;
} else {
$db_menuinit .= ",'td_userinfomore' : 'menu_userinfomore','td_profile' : 'menu_profile'";
print <<<EOT
-->
<dl class="login fr">
  	 <dt class="fr"><a href="u.php" hidefocus="true" class="img_50"><img alt="$windid" src="$_LoginInfo[faceurl]" /></a></dt>
       	<dd class="fr">
         	<p class="l_info mb5"><span id="td_userinfomore" style="padding:0 5px;"><a href="u.php" class="b link_down"><span>$windid</span></a></span><span class="mr5"></span><a href="$loginouturl" class="mr5">退出</a><span class="gray mr5">|</span>
<script type="text/javascript">
var td_userinfomore = {
	pz : 21,
	open : function() {
		getObj('td_userinfomore').className = 'current';
		if (typeof userBinding == 'object') {
			userBinding.append();
		}
	},
	close : function () {
		getObj('td_userinfomore').className = '';
	}
}
</script>
<a href="message.php" class="mr5">消息{$tmpMsgNums}</a><span id="td_profile" class="pd5"><a id="td_profile" class="link_down" href="profile.php?action=modify" target="_blank"><span>设置</span></a></span><!--
EOT;
if(CkInArray($windid,$manager) || $SYSTEM['allowadmincp']){
print <<<EOT
--><span class="gray mr5">|</span><a href="$db_adminfile" target="_blank">系统设置</a>
<!--
EOT;
}
print <<<EOT
--></p>
			<p>{$db_moneyname}：<a href="userpay.php" class="mr10">$winddb[money] $db_moneyunit</a>{$db_rvrcname}：<a href="userpay.php" class="mr10">$userrvrc $db_rvrcunit</a>身份：<a href="profile.php?action=permission
">{$gp_grouptitle}</a></p>
		</dd>
	</dl>
<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
if (getstatus($winddb['userstatus'],12)) {print <<<EOT
-->
<script type="text/javascript" src="js/userbinding.js"></script>
<!--
EOT;
}if ($winduid){print<<<EOT
-->
<div id="menu_userinfomore" class="cc pw_menu" style="display:none;">
	<h6 style="left:-1px;right:auto;"><a href="u.php" class="b link_down"><span>$windid</span></a></h6>
	<div>
		<ul class="menu-half cc" style="width:26em;">
<!--
EOT;
if ($gp_gptype == 'member') {print <<<EOT
-->
		<li>等级: $gp_grouptitle</li>
<!--
EOT;
} else {print <<<EOT
-->
		<li>身份: $gp_grouptitle</li>
<!--
EOT;
}if ($_G['allowhide']) {print <<<EOT
-->
		<li>状态:
<span style="cursor:pointer;" onclick="ajax.send('pw_ajax.php?action=changestate','',changeState)" id="online_state">
<!--
EOT;
if (GetCookie('hideid') == 1) {print <<<EOT
--><img src="$imgpath/stealth.png" align="absmiddle" />隐身
<!--
EOT;
} else {print <<<EOT
--><img src="$imgpath/online.png" align="absmiddle" />在线
<!--
EOT;
}print <<<EOT
--></span>
<script type="text/javascript">
function changeState() {
	var msg = ajax.request.responseText;
	if (msg == 1){
		getObj('online_state').innerHTML = '<img src="$imgpath/stealth.png" align="absmiddle" />隐身';
	}else{
		getObj('online_state').innerHTML = '<img src="$imgpath/online.png" align="absmiddle" />在线';
	}
}
</script>
			</li>
<!--
EOT;
}print <<<EOT
-->
			<li>帖子: $winddb[postnum]</li>
			<li>今日: $winddb[todaypost]</li>
			<li>$db_rvrcname: $userrvrc $db_rvrcunit</li>
			<li>$db_moneyname: $winddb[money] $db_moneyunit</li>
			<li>$db_creditname: $winddb[credit] $db_creditunit</li>
			<li>最后登录: <span class="f10">{$_LoginInfo['lastlodate']}</span></li>
			<li style="width:90%">登录IP: <span class="f10">$onlineip</span></li>
		</ul>
		<div class="userbindingMenu"></div>
	</div>
</div>
<div id="menu_profile" class="pw_menu" style="display:none">
	<h6><a href="profile.php?action=modify" class="link_down"><span>设置</span></a></h6>
    <ul style="width:50px;" class="menuList">
        <li><a href="profile.php?action=modify" target="_blank">帐号</a></li>
<!--
EOT;
if ($db_authstate) {print <<<EOT
-->
		<li><a href="profile.php?action=auth" target="_blank">认证</a></li>
<!--
EOT;
}print <<<EOT
-->
        <li><a href="profile.php?action=privacy" target="_blank">隐私</a></li>
        <li><a href="userpay.php" target="_blank">积分</a></li>
        <li><a href="profile.php?action=permission" target="_blank">权限</a></li>
    </ul>
</div>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if ($ifChannelEdit && !$ifactive) {
print <<<EOT
-->
	<div class="pw_diy" id="J_channelManage">
		<div id="pw_divTop"></div>
		<p><a href="index.php?m=area&alias={$alias}&adminview=1">模块管理</a></p>
	</div>
<!--
EOT;
}
print <<<EOT
-->
<script type="text/javascript">var verifyhash = '$verifyhash', av_alias = '$alias', av_url = '$channelInfo[url]';</script>
<!--
EOT;
$hasNewMessage = $winddb['newpm'] || $winddb['newreferto'] || $winddb['newnotice'] || $winddb['newrequest'] || $winddb['newfans'];
$tmpMsgNum = 0;
($winddb['newpm']>0 && $_G['maxmsg']>=0) && $tmpMsgNum += $winddb['newpm'];
$winddb['newreferto']>0 && $tmpMsgNum += $winddb['newreferto'];
$winddb['newnotice']>0 && $tmpMsgNum += $winddb['newnotice'];
$winddb['newcomment']>0 && $tmpMsgNum += $winddb['newcomment'];
$winddb['newfans']>0 && $tmpMsgNum += $winddb['newfans'];
$tmpMsgNums = $tmpMsgNum > 0 ? '('.$tmpMsgNum.')' : '';
if($winduid && $hasNewMessage && (!GetCookie('clearm_'.$winduid) || GetCookie('clearm_'.$winduid) < $tmpMsgNum)){print <<<EOT
-->
<div id="pw_all_tip" style="display:none;" data-msg='[{"num":{$winddb['newpm']},"name":"站内信","url":"message.php?type=sms"},{"num":{$winddb['newreferto']},"name":"提到我","url":"apps.php?q=weibo&do=refer"},{"num":{$winddb['newnotice']},"name":"新通知","url":"message.php?type=notice"},{"num":{$winddb['newfans']},"name":"新关注","url":"u.php?a=friend&type=attentioned"},{"num":{$winddb['newrequest']},"name":"新请求","url":"message.php?type=request"}]'>
<table><tr><td>
<div class="pw_all_tip">
	<a href="javascript:void(0)" class="adel" id="pw_all_tclose" data-num="{$tmpMsgNum}">关闭</a>
<!--
EOT;
	if($winddb['newpm']){print <<<EOT
-->
	<p>{$winddb['newpm']}条新站内信，<a href="message.php?type=sms">查看站内信</a></p>
<!--
EOT;
}if($winddb['newreferto']){print <<<EOT
-->
	<p>{$winddb['newreferto']}条信息提到我，<a href="apps.php?q=weibo&do=refer">查看@我</a></p>
<!--
EOT;
}if($winddb['newnotice']){print <<<EOT
-->
	<p>{$winddb['newnotice']}个新通知，<a href="message.php?type=notice">查看新通知</a></p>
<!--
EOT;
}if($winddb['newfans']){print <<<EOT
-->
	<p>{$winddb['newfans']}个新关注，<a href="u.php?a=friend&type=attentioned">查看新关注</a></p>
<!--
EOT;
}if($winddb['newrequest']){print <<<EOT
-->
	<p>{$winddb['newrequest']}个新请求，<a href="message.php?type=request">查看新请求</a></p>
<!--
EOT;
}print <<<EOT
-->
</div></td></tr></table></div>
<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
?>-->